package com.tarena.jdbc;

import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;

public class AddTest {
	public static void main(String[] args)throws Exception{
		//注册驱动
		Class.forName("oracle.jdbc.driver.OracleDriver");
		//建立连接 测试连接
		Connection conn = DriverManager.getConnection(
				"jdbc:oracle:thin:@192.168.10.22:1521:tarena",
				"openlab",
				"open123");
		System.out.println(conn);
		//sql
		Statement statement=conn.createStatement();
		String sql = "insert into dept_snail values(50,'fuckyou','fuzhou')";
		//返回
		int n = statement.executeUpdate(sql);
		System.out.println(n);
		//关闭连接
		statement.close();
		conn.close();		
	}
}
